/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package prototype;

import java.util.Scanner;
import java.util.ArrayList;
/**
 *
 * @author Arch
 */
public class Prompter {
    
    private static String[] Yess = { "Igen", "igen", "Yes", "yes", "Da", "Ja", "i", "I", "y", "Y" };
    private static String[] Noo = { "Nem", "nem", "Ne", "ne", "No", "no", "Nyet", "Nein", "n", "N" };
    private static ArrayList<String>Yes = new ArrayList<String>();
    private static ArrayList<String>No = new ArrayList<String>();

    static{
        for (String ans : Yess)
            Yes.add(ans);

        for (String ans : Noo)
            No.add(ans);
    }

    public static String Question(String question){
        Scanner n = new Scanner(System.in);

        System.out.println();
        System.out.print(question);
        String ans =  n.nextLine();        
        System.out.println();

        return ans;
    }

    public static int Switch(String[] questions)
    {
        Scanner n = new Scanner(System.in);
        int a=0;
        int choosen=-1;
        System.out.println("-----");
        for (String item : questions) {
            System.out.println(a++ + " - " + item);
        }
        System.out.println("-----");

        while (choosen < 0 || choosen >= questions.length) {
            System.out.print("Answer: ");
            try {
                choosen = n.nextInt();
            } catch (Exception ex)
            {
                System.out.println("Not valid input!");
                choosen = -1;
                n.nextLine();
            }
        }
        
        return choosen;
    }

    public static boolean YesNo(String question)
    {
        Scanner n = new Scanner(System.in);
        String a = "";

        while (!(Yes.contains(a) || No.contains(a))) {
            System.out.print(question);
            try {
                a = n.next();
                n.skip("*");
            } catch (Exception ex)
            {
                
            }
        }
        if (Yes.contains(a)) return true;
        return false;
    }   
}
